(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-awesome-tab"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-auto-save"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-awesome-pair"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-color-rg"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-company-english-helper"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-insert-translated-name"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-open-newline"))
(add-to-list 'load-path (expand-file-name "~/.spacemacs.d/modules/lazycat-thing-edit"))


;; un-display frame-title
;; use tab as header
(set-frame-parameter (car (frame-list)) 'undecorated t)

;; manateelazycat/awesome-tab
(require 'awesome-tab)
(awesome-tab-mode t)
(awesome-tab-build-helm-source)

;; select tab with awesome-tab
(bind-key* "s-n" 'awesome-tab-forward)
(bind-key* "s-p" 'awesome-tab-backward)
(bind-key* "C-x K" 'awesome-tab-kill-all-buffers-in-current-group)
;; jump cursor among windows
(bind-key* "s-h" 'evil-window-left)
(bind-key* "s-j" 'evil-window-down)
(bind-key* "s-k" 'evil-window-up)
(bind-key* "s-l" 'evil-window-right)
;; automatically recognizes the number and switches to the tab
(bind-key* "s-1" 'awesome-tab-select-visible-tab)
(bind-key* "s-2" 'awesome-tab-select-visible-tab)
(bind-key* "s-3" 'awesome-tab-select-visible-tab)
(bind-key* "s-4" 'awesome-tab-select-visible-tab)
(bind-key* "s-5" 'awesome-tab-select-visible-tab)
(bind-key* "s-0" 'awesome-tab-select-visible-tab)

(custom-set-faces
 '(awesome-tab-selected ((t (:background "#26c281" :foreground "#fff143"))))
 '(awesome-tab-unselected ((t (:background "#6c7a89" :foreground "#e3f9fd")))))


(require 'auto-save)

(auto-save-enable)
(setq auto-save-slient t)
(setq auto-save-delete-trailing-whitespace t)


(require 'awesome-pair)

(dolist (hook (list
               'c-mode-common-hook
               'c-mode-hook
               'c++-mode-hook
               'java-mode-hook
               'haskell-mode-hook
               'emacs-lisp-mode-hook
               'lisp-interaction-mode-hook
               'lisp-mode-hook
               'maxima-mode-hook
               'ielm-mode-hook
               'sh-mode-hook
               'makefile-gmake-mode-hook
               'php-mode-hook
               'python-mode-hook
               'js-mode-hook
               'go-mode-hook
               'qml-mode-hook
               'jade-mode-hook
               'css-mode-hook
               'ruby-mode-hook
               'coffee-mode-hook
               'rust-mode-hook
               'qmake-mode-hook
               'lua-mode-hook
               'swift-mode-hook
               'minibuffer-inactive-mode-hook
               ;; add more mode-hook
               'cperl-mode-hook
               'ess-r-mode-hook
               'org-mode-hook
               'yaml-mode-hook
               ))
  (add-hook hook '(lambda () (awesome-pair-mode 1))))

(define-key awesome-pair-mode-map (kbd "(") 'awesome-pair-open-round)
(define-key awesome-pair-mode-map (kbd "[") 'awesome-pair-open-bracket)
(define-key awesome-pair-mode-map (kbd "{") 'awesome-pair-open-curly)
(define-key awesome-pair-mode-map (kbd ")") 'awesome-pair-close-round)
(define-key awesome-pair-mode-map (kbd "]") 'awesome-pair-close-bracket)
(define-key awesome-pair-mode-map (kbd "}") 'awesome-pair-close-curly)
(define-key awesome-pair-mode-map (kbd "=") 'awesome-pair-equal)

(define-key awesome-pair-mode-map (kbd "%") 'awesome-pair-match-paren)
(define-key awesome-pair-mode-map (kbd "\"") 'awesome-pair-double-quote)

(define-key awesome-pair-mode-map (kbd "SPC") 'awesome-pair-space)

(define-key awesome-pair-mode-map (kbd "M-o") 'awesome-pair-backward-delete)
(define-key awesome-pair-mode-map (kbd "C-d") 'awesome-pair-forward-delete)
(define-key awesome-pair-mode-map (kbd "C-k") 'awesome-pair-kill)

(define-key awesome-pair-mode-map (kbd "M-\"") 'awesome-pair-wrap-double-quote)
(define-key awesome-pair-mode-map (kbd "M-[") 'awesome-pair-wrap-bracket)
(define-key awesome-pair-mode-map (kbd "M-{") 'awesome-pair-wrap-curly)
(define-key awesome-pair-mode-map (kbd "M-(") 'awesome-pair-wrap-round)
(define-key awesome-pair-mode-map (kbd "M-s") 'awesome-pair-unwrap)

(define-key awesome-pair-mode-map (kbd "M-n") 'awesome-pair-jump-right)
(define-key awesome-pair-mode-map (kbd "M-p") 'awesome-pair-jump-left)
(define-key awesome-pair-mode-map (kbd "M-:") 'awesome-pair-jump-out-pair-and-newline)


(require 'color-rg)

(bind-key* "C-c d" 'color-rg-search-project)
(bind-key* "s-d" 'color-rg-search-project)
(bind-key* "s-s" 'color-rg-search-input-in-current-file)


(require 'company-english-helper)

;; toggle of Writting with company-english-helper
(bind-key* "C-c e" 'toggle-company-english-helper)
(bind-key* "s-e" 'toggle-company-english-helper)


;; manateelazycat/insert-translated-name
(require 'insert-translated-name)

;; Insert-translated-name
(bind-key* "C-c i" 'insert-translated-name-insert)
(bind-key* "s-i" 'insert-translated-name-insert)


(require 'open-newline)
(bind-key* "C-S-o" 'open-newline-above)
(bind-key* "C-o" 'open-newline-below)


(require 'thing-edit)
(bind-key* "C-S-w" 'thing-cut-word)
(bind-key* "M-W" 'thing-copy-word)
(bind-key* "C-S-r" 'thing-replace-word)


(provide 'init-lazycat-modules)
